Saturn's moon Titan has a nitrogen atmosphere comparable to Earth's, with a surface pressure of 1.4 bar. Numerical models reproduce the tropospheric conditions very well but have trouble explaining the observed middle-atmosphere temperatures, composition and winds. The top of the middle-atmosphere circulation has been thought to lie at an altitude of 450 to 500 kilometres, where there is a layer of haze that appears to be separated from the main haze deck. This 'detached' haze was previously explained as being due to the colocation of peak haze production and the limit of dynamical transport by the circulation's upper branch. Herewe report a build-up of trace gases over the south pole approximately two years after observing the 2009 post-equinox circulation reversal, from which we conclude that middle-atmosphere circulation must extend to an altitude of at least 600 kilometres. The primary drivers of this circulation are summer-hemisphere heating of haze by absorption of solar radiation and winter-hemisphere cooling due to infrared emission by haze and trace gases; our results therefore imply that these effects are important well into the thermosphere (altitudes higher than 500 kilometres). This requires both active upper-atmosphere chemistry, consistent with the detection of high-complexity molecules and ions at altitudes greater than 950 kilometres, and an alternative explanation for the detached haze, such as a transition in haze particle growth from monomers to fractal structures.